import request from "@/utils/request.ts";

export const home = {
    getVideoList(status: string) {
        return request.get(`/api/v1/videos/list?status=${status}`)
    },
    getTask() {
        return request.get("/api/v1/videos/task")
    },
    getFiles(directory_path: string) {
        return request.get(`/api/v1/videos/merger/files?directory_path=${directory_path}`)
    },
    getPoltType() {
        return request.get('/api/v1/polt_type/polt_type')
    },
    getSubtitle(analysis_uuid: string, segment: number, first_text: string, second_text: string) {
        return request.post("/api/v1/videos/subtitle", {
            analysis_uuid,
            segment,
            first_text,
            second_text
        }, {headers: {"Content-Type": "application/json"}});
    },
    getMerger(directory_path: string, file_order: any, output_path: any) {
        return request.post("/api/v1/videos/merger", {
            directory_path,
            file_order,
            output_path
        }, {headers: {"Content-Type": "application/json"}});
    },

    getAddPoltType(name: string, description: string) {
        return request.post('/api/v1/polt_type/polt_type', {name, description})
    },
    getDeletePoltType(id: string) {
        return request.delete(`/api/v1/polt_type/polt_type?id=${id}`);
    },
    getModifyPoltType(id: string, name: string, description: string) {
        return request.put("/api/v1/polt_type/polt_type", {id, name, description});
    },
    getAddATriviaControl(formData: any) {
        return request.post("/api/v1/videos/upload", {
            formData
        }, {
            headers: {
                "Content-Type": "multipart/form-data"
            }
        });
    },
    getFindMissingSteps() {
        return request.get('/api/v1/videos/findMissingSteps');
    },
    getSearch(value: string, value1: string, value2: string,name1: string,name2: string) {
        return request.get(`/api/v1/videos/findMissingSteps?select=${value}&startTime=${value1}&endTime=${value2}&handmadeName=${name1}&theNameOfTheOriginalVideo=${name2}`, );
    },

    getUploadVideo(formData:any) {
        return request.post('/api/v1/videos/upload',formData,{headers:{"Content-Type":"multipart/form-data"}});
    },
    getUploadAudio(formData:any) {
        return request.post('/api/v1/videos/audio',formData,{headers:{"Content-Type":"multipart/form-data"}});
    },
    getClay_material() {
        return request.get('/api/v1/clay_material/');
    },
    getAddClay_material(name:string,created_by:number) {
        return request.post('/api/v1/clay_material/',{name,created_by});
    },
    getModifyClay_material(name:string,uuid:string) {
        return request.put('/api/v1/clay_material/',{name,uuid});
    },
    getDeleteClay_material(uuid:string) {
        return request.delete(`/api/v1/clay_material/?uuid=${uuid}`,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});
    },
}

